#pragma once
#include <nice2d/widgets/abstractslider.h>

class ProgressBarStyle : public ControlStyle
{
    DECLARE_OBJECT(ProgressBarStyle)
public:
    ProgressBarStyle();
public:
    virtual PTree serialize()override;
    virtual void deserialize(const PTree &node)override;
    virtual void sync()override;
public:
    sf::Color progressBarColor = sf::Color(180, 180, 180,240);
    std::string fontFile = "./../data/arial.ttf";
    float characterSize = 12.0f;
    sf::Text::Style style = sf::Text::Regular;
    sf::Color textColor = sf::Color::White;
};

class ProgressBar : public AbstractSlider
{
    DECLARE_OBJECT(ProgressBar)
public:
    ProgressBar();
    ~ProgressBar();
public:
    void setTextVisible(bool visible);
    bool isTextVisible()const;

    void setOrientation(Orientation orientation);
    Orientation getOrientation()const;
protected:
    void onDrawControl(sf::RenderTarget &target, sf::RenderStates states) const override;
    void onPositionChanged() override;
    void onValueChanged() override;

    virtual void onStyleChanged()override;
private:
    std::unique_ptr<class ProgressBarData> data;
};
